import express from 'express'
import { authMiddleware } from '../middleware/auth'
import { errorResponse, successResponse } from '../utils/responseHandler'

const router = express.Router()

// 获取当前用户信息
router.get('/me', authMiddleware, async (req: express.Request, res: express.Response) => {
  try {
    const user = (req as any).user
    return successResponse(res, user)
  } catch (error) {
    return errorResponse(res, 500, 'Failed to fetch user info')
  }
})

export default router
